#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <arpa/inet.h>

#define PORT 8080
#define BACKLOG 32

int main()
{
    struct sockaddr_in server_addr;
    int server_fd;

    if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
    {
        perror("socket");
        exit(-1);
    }

    server_addr.sin_family = AF_INET;
    server_addr.sin_port = htons(PORT);
    server_addr.sin_addr.s_addr = htonl(INADDR_ANY);

    if (connect(server_fd, &server_addr, sizeof(struct sockaddr_in)) < 0)
    {
        perror("bind");
        exit(-1);
    }

    char buffer[1024];
    while (1)
    {
        printf("What you want to send?\n");
        scanf("%s", buffer);
        send(server_fd, buffer, strlen(buffer), 0);
    }
    return 0;
}
